<template>
  <div>
      <el-button type="primary" @click="add">添加</el-button>
      <v-add :obj="obj" ref="oCh"></v-add>
      <v-list @edit="edit"></v-list>
  </div>
</template>
<script>
import vAdd from "./components/add.vue"
import vList from "./components/list.vue"
import { mapGetters, mapActions } from "vuex";
export default {
  props: [],
  components: {
    vAdd,
    vList
  },
  data() {
    return {
      obj:{
        //用来控制对话框 显示/隐藏
        isTrue:false,
        //用来标识你点的是添加还是编辑
        isAdd:false
      }
    };
  },
  computed: {
    ...mapGetters({}),
  },
  methods: {
    ...mapActions({}),
    //点击添加按钮
    add(){
      //让对话框显示
      this.obj.isTrue = true
      //标识点击的是添加按钮
      this.obj.isAdd=true
    },
    edit(id){
      //让对话框显示
      this.obj.isTrue = true
      //标识点击的是编辑按钮
      this.obj.isAdd=false
      //
      this.$refs.oCh.getinfo(id)
    }
  },
  mounted() {
    // console.log(this);
  },
};
</script>
<style scoped>
</style>